<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>欢迎使用</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  {include file="public/css"/}
	<style>
	.layui-col-sm6,.layui-col-sm12{padding-top:0;padding-left:0}
	</style>
</head>
<body>
  <div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        {if $bid > 0 && $businessEndtime}
        {if $businessStatus == 'expire'}<blockquote class="layui-elem-quote" style="background-color: #ffffff;border-left-color: red;">已过期，请续费</blockquote>{/if}
        <blockquote class="layui-elem-quote" style="background-color: #ffffff;{if $businessStatus == 'expire'}border-left-color: red;{/if}">到期时间：{:date('Y-m-d H:i',$businessEndtime)}</blockquote>
        {/if}
			{if $bid == 0}
			<div class="layui-col-sm6 layui-col-md3">
        <div class="layui-card">
          <div class="layui-card-header">账户信息(ID:{$aid})</div>
          <div class="layui-card-body layuiadmin-card-list" style="padding-top:5px">
            <div class="layuiadmin-big-font" style="font-size:20px;height: 54px;overflow:hidden;display:flex;align-items:center">
							{if in_array('mp',$platform)}
								{if $mpinfo && $mpinfo['appid']}
								<div style="display:flex;align-items:center;margin-right:10px;cursor:pointer;height:40px;overflow:hidden" onclick="location.href='{:url('binding/index')}'">
									<img src="{$mpinfo.headimg|default='__STATIC__/img/wxtx.png'}" style="width:40px;height:40px;border-radius:50%"/>
									<div style="margin-left:10px;margin-right:10px;display:flex;flex-direction:column">
										<span style="font-size:16px;white-space:nowrap;overflow:hidden">{$mpinfo.nickname|default="暂无昵称"}</span>
										<span style="font-size:10px;color:#73d78e;line-height:12px;">
											{if $mpinfo.level==2 || $mpinfo.level==4}服务号{else}订阅号{/if}&nbsp;
											{if $mpinfo.level==3 || $mpinfo.level==4}<span style="color:#53d78e;"><i class="fa fa-check-circle"></i> 已认证</span>{else}<span style="color:#f85;">未认证</span>{/if}	
										</span>
									</div>
								</div>
								{else}
								<div style="display:flex;align-items:center;margin-right:10px">
									<a href="{:url('binding/index')}" style="color:#1E9FFF;font-size:16px;height:20px;line-height:20px">未绑定公众号</a>
								</div>
								{/if}
							{/if}
							{if in_array('wx',$platform)}
								{if $wxapp && $wxapp['appid']}
								<div style="display:flex;align-items:center;margin-right:10px;cursor:pointer;height:40px;overflow:hidden;width:50%" onclick="location.href='{:url('binding/index')}'">
									<img src="{$wxapp.headimg|default='__STATIC__/img/wxtx.png'}" style="width:40px;height:40px;border-radius:50%"/>
									<div style="margin-left:10px;margin-right:10px;display:flex;flex-direction:column">
										<span style="font-size:16px;white-space:nowrap;overflow:hidden">{$wxapp.nickname|default="暂无昵称"}</span>
										<span style="font-size:10px;color:#73d78e;line-height:12px;">小程序&nbsp;</span>
									</div>
								</div>
								{else}
								<div style="display:flex;align-items:center;margin-right:10px">
									<a href="{:url('binding/index')}" style="color:#3EAFCC;font-size:16px;height:20px;line-height:20px">未绑定小程序</a>
								</div>
								{/if}
							{/if}
						</div>
            <p>当前账号：<span class="layuiadmin-span-color">{:session('ADMIN_NAME')}</span></p>
            {if $aid==1 && $bid==0}
            <p>系统时间：<span class="layuiadmin-span-color" id="systime">{:date('Y-m-d H:i:s')}</span></p>
						{else}
						<p>到期时间：<span class="layuiadmin-span-color">{:date('Y-m-d H:i',$endtime)}</span></p>
						{/if}
          </div>
        </div>
      </div>
        {if in_array('all', $pc_index_data) || in_array('custom_num', $pc_index_data)}
			<div class="layui-col-sm6 layui-col-md3">
        <div class="layui-card">
          <div class="layui-card-header">客户总数<span style="float:right;color:#666">今日新增&nbsp;{:number_format($memberThisDayCount)}</span></div>
          <div class="layui-card-body layuiadmin-card-list">
            <p class="layuiadmin-big-font" style="cursor:pointer" onclick="location.href='{:url('member/index')}'">{:number_format($memberCount)}</p>
            <p>昨日新增 <span class="layuiadmin-span-color">{:number_format($memberLastDayCount)}</span></p>
            <p>本月新增 <span class="layuiadmin-span-color">{:number_format($memberThisMonthCount)}</span></p>
          </div>
        </div>
      </div>
        {/if}
        {if in_array('all', $pc_index_data) || in_array('receive_money', $pc_index_data)}
			<div class="layui-col-sm6 layui-col-md3">
        <div class="layui-card">
          <div class="layui-card-header">
						<div class="layui-inline">
							收款金额
<!--							<div class="layui-text-popover">-->
<!--								<i class="layui-icon layui-icon-about layui-default-link"></i> -->
<!--								<div class="layui-textpopover-div">-->
<!--									<div class="layui-textpopover-text">-->
<!--										所有订单支付的总金额（不含退款）-->
<!--									</div>-->
<!--								</div>-->
<!--							</div>-->
						</div>
						<span style="float:right;color:#666">今日新增&nbsp;{:number_format($payThisDayCount,2)}</span></div>
          <div class="layui-card-body layuiadmin-card-list">
            <p class="layuiadmin-big-font" style="color:#558800"><span style="font-size:16px;height:20px;line-height:20px">￥</span>{:number_format($payCount,2)}</p>
            <p>昨日新增 <span class="layuiadmin-span-color">￥{:number_format($payLastDayCount,2)}</span></p>
            <p>本月新增 <span class="layuiadmin-span-color">￥{:number_format($payThisMonthCount,2)}</span></p>
          </div>
        </div>
      </div>
        {/if}
        {if in_array('all', $pc_index_data) || in_array('withdraw_money', $pc_index_data)}
			<div class="layui-col-sm6 layui-col-md3">
        <div class="layui-card">
          <div class="layui-card-header">已提现金额<span style="float:right;color:#666">今日新增&nbsp;{:number_format($withdrawThisDayCount,2)}</span></div>
          <div class="layui-card-body layuiadmin-card-list">
            <p class="layuiadmin-big-font"><span style="font-size:16px;height:20px;line-height:20px">￥</span>{:number_format($withdrawCount,2)}</p>
            <p>昨日新增 <span class="layuiadmin-span-color">￥{:number_format($withdrawLastDayCount,2)}</span></p>
            <p>本月新增 <span class="layuiadmin-span-color">￥{:number_format($withdrawThisMonthCount,2)}</span></p>
          </div>
        </div>
      </div>
        {/if}
			{/if}
        {if in_array('all', $pc_index_data) || in_array('product_num', $pc_index_data)}
			<div class="layui-col-sm6 layui-col-md3">
        <div class="layui-card">
          <div class="layui-card-header">商品数量</div>
          <div class="layui-card-body layuiadmin-card-list">
            <p class="layuiadmin-big-font" style="cursor:pointer" onclick="location.href='{:url('shopProduct/index')}'">{:number_format($productCount)}</p>
            <p>未上架 <span class="layuiadmin-span-color">{:number_format($product0Count)}</span></p>
            <p>已上架 <span class="layuiadmin-span-color">{:number_format($product1Count)}</span></p>
          </div>
        </div>
      </div>
        {/if}

        {if in_array('all', $pc_index_data) || in_array('order_num', $pc_index_data)}
			<div class="layui-col-sm6 layui-col-md3">
        <div class="layui-card">
          <div class="layui-card-header">订单数<span style="float:right;color:#666">今日新增&nbsp;{:number_format($orderallThisDayCount)}</span></div>
          <div class="layui-card-body layuiadmin-card-list">
            <p class="layuiadmin-big-font" style="cursor:pointer" onclick="location.href='{:url('shopOrder/index')}'">{:number_format($orderallCount)}</p>
            <p>昨日新增 <span class="layuiadmin-span-color">{:number_format($orderallLastDayCount)}</span></p>
            <p>本月新增 <span class="layuiadmin-span-color">{:number_format($orderallThisMonthCount)}</span></p>
          </div>
        </div>
      </div>
        {/if}
        {if in_array('all', $pc_index_data) || in_array('order_money', $pc_index_data)}
			<div class="layui-col-sm6 layui-col-md3">
        <div class="layui-card">
          <div class="layui-card-header">订单金额<span style="float:right;color:#666">今日新增&nbsp;{:number_format($orderMoneyThisDayCount,2)}</span></div>
          <div class="layui-card-body layuiadmin-card-list">
            <p class="layuiadmin-big-font" style="cursor:pointer" onclick="location.href='{:url('shopOrder/index')}'"><span style="font-size:16px;height:20px;line-height:20px">￥</span>{:number_format($orderMoneyCount,2)}</p>
            <p>昨日新增 <span class="layuiadmin-span-color">￥{:number_format($orderMoneyLastDayCount,2)}</span></p>
            <p>本月新增 <span class="layuiadmin-span-color">￥{:number_format($orderMoneyThisMonthCount,2)}</span></p>
          </div>
        </div>
      </div>
        {/if}

        {if in_array('all', $pc_index_data) || in_array('refund_money', $pc_index_data)}
			<div class="layui-col-sm6 layui-col-md3">
        <div class="layui-card">
          <div class="layui-card-header">已退款金额<span style="float:right;color:#666">今日新增&nbsp;{:number_format($refundThisDayCount,2)}</span></div>
          <div class="layui-card-body layuiadmin-card-list">
            <p class="layuiadmin-big-font" style="color:#885500"><span style="font-size:16px;height:20px;line-height:20px">￥</span>{:number_format($refundCount,2)}</p>
            <p>昨日新增 <span class="layuiadmin-span-color">￥{:number_format($refundLastDayCount,2)}</span></p>
            <p>本月新增 <span class="layuiadmin-span-color">￥{:number_format($refundThisMonthCount,2)}</span></p>
          </div>
        </div>
      </div>
        {/if}


			
        

		
	  	
      <div class="layui-col-sm12">
				<div class="layui-card"> 
					<div class="layui-card-header">最近30天数据曲线</div>
					<div class="layui-card-body">
						<div class="layui-row">
							<div class="layui-col-sm9">
								<div class="layui-carousel layadmin-carousel layadmin-dataview" style="width:100%" id="chart1"></div>
							</div>
							<div class="layui-col-sm3">
								<div style="padding-top:70px"></div>
								{if $bid == 0}
								<div style="margin:5px 0;"><span onclick="getchart(1,'客户总数')" style="cursor:pointer">客户总数</span></div>
								<div style="margin:5px 0;"><span onclick="getchart(2,'新增客户数')" style="cursor:pointer">新增客户数</span></div>
								<div style="margin:5px 0;"><span onclick="getchart(3,'收款金额')" style="cursor:pointer">收款金额</div>
								{/if}
								<div style="margin:5px 0;"><span onclick="getchart(4,'订单金额')" style="cursor:pointer">订单金额</div>
								<div style="margin:5px 0;"><span onclick="getchart(5,'订单数')" style="cursor:pointer">订单数</div>
							</div>
						</div>
					</div>
				</div>
      </div>
		</div>
  </div>
	{include file="public/js"/}
	<script src="__STATIC__/admin/js/echarts.min.js"></script>
	<script type="text/javascript">
	var nowtime = "{:time()}";
	$(function(){
		setInterval(function(){
			nowtime++;
			var date = getLocalTime(nowtime);
			$('#systime').html(date);
		},1000)
	})
	function getLocalTime(time) {     
		var date = new Date(time * 1000);  
		var year = date.getFullYear();
		var month = date.getMonth() + 1;
		var day = parseInt(date.getDate());
		var hour = date.getHours();
		var minute = date.getMinutes();
		var second = date.getSeconds();
		return year + '-' + (month <10 ? '0' + month : month) + '-' + (day < 10 ? ('0' + day) : day) + ' '+(hour <10 ? '0' + hour : hour)+':'+(minute <10 ? '0' + minute : minute)+':'+(second <10 ? '0' + second : second);  
	}
	var myChart = echarts.init(document.getElementById("chart1"));
	{if $bid == 0}
	option = {
		title: {
			text: '客户数',textStyle:{fontSize:12},x: "center"
		},
		tooltip: {
			trigger: 'axis'
		},
		xAxis: {
			//name:'日期',
			boundaryGap: false,
			type: 'category',
			data: {:json_encode($dateArr)}
		},
		yAxis: {
			type: 'value'
		},
		series: [{
			name:'客户数',
			data: {:json_encode($dataArr)},
			type: 'line'
		}]
	}
	{else}
	option = {
		title: {
			text: '订单金额',textStyle:{fontSize:12},x: "center"
		},
		tooltip: {
			trigger: 'axis'
		},
		xAxis: {
			//name:'日期',
			boundaryGap: false,
			type: 'category',
			data: {:json_encode($dateArr)}
		},
		yAxis: {
			type: 'value'
		},
		series: [{
			name:'订单金额',
			data: {:json_encode($dataArr)},
			type: 'line'
		}]
	}
	{/if}
	myChart.setOption(option,true);
	//getchart(1,'客户数');
	function getchart(type,title){
		var index = layer.load();
		$.post('',{op:'getdata',type:type},function(res){
			layer.close(index);
			option = {
				title: {
					text: title,textStyle:{fontSize:12},x: "center"
				},
				tooltip: {
					trigger: 'axis'
				},
				xAxis: {
					//name:'日期',
					boundaryGap: false,
					type: 'category',
					data: res.dateArr
				},
				yAxis: {
					type: 'value'
				},
				series: [{
					name:title,
					data: res.dataArr,
					type: 'line'
				}]
			}
			myChart.setOption(option,true);
		})
		
	}
    let money_notice = '{$money_notice_value}';
    if(money_notice > 0){
        layer.open({
            title: '余额提醒',
            content: '可用额度不足'+money_notice+'元，请及时充值。余额无法扣款时，所有增值功能无法使用，影响商用后果自负！' //这里content是一个普通的String
        });
    }

	</script>
	{include file="public/copyright"/}
</body>
</html>